<template>
  <div style="margin-top:30px">
    <el-form ref="form" :model="formdata" label-width="240px" style="width:900px">
      <!-- APPID -->
      <el-form-item label="打卡得积分：">
        <el-input v-model="formdata.sign_score" :min="1" type="number" placeholder="请输入打卡得积分" />
      </el-form-item>
      <el-form-item label="文明宣言：">
        <el-input v-model="formdata.sign_des" type="textarea" :rows="4" placeholder="请输入文明宣言" />
      </el-form-item>
      <el-form-item>
        <el-alert title="多条宣言回车换行区分" :closable="false" type="info" />
      </el-form-item>
      <el-form-item label="文明行为获得积分：">
        <el-input v-model="formdata.act_score" type="number" :min="0" placeholder="文明行为获得积分" />
      </el-form-item>
      <el-form-item label="文明行为每日最高获得积分：">
        <el-input v-model="formdata.act_score_max" type="number" :min="0" placeholder="请输入文明行为每日最高获得积分" />
      </el-form-item>
      <el-form-item label="文明小贴士：">
        <el-input v-model="formdata.rule" type="textarea" :rows="4" placeholder="请输入文明小贴士" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="savebtn">保存</el-button>
        <!-- <el-button>取消</el-button> -->
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getbas, saves } from '../../api/userlist'
export default {
  name: 'Classify',
  data() {
    return {
      tableData: [],
      formdata: {
        sign_score: '',
        sign_des: '',
        act_score: '',
        act_score_max: '',
        rule: ''
      }
    }
  },
  created() {
    this._getTableData()
  },
  methods: {
    // 修改状态
    _getTableData() {
      this.tableLoading = true
      getbas().then(res => {
        this.formdata = res
      }).finally(() => {
        this.tableLoading = false
      })
    },
    savebtn() {
      const { formdata } = this
      saves({ ...formdata }).then(res => {
        this._getTableData()
      }).finally(() => {
        this.tableLoading = false
      })
    }
  }
}
</script>
<style scoped>
.imgss{
  width: 50px;
  height: 50px;
}
</style>
